#ifndef TCPSERVER_H
#define TCPSERVER_H

#include <QTcpServer>
#include "tcpbase.h"

enum ServerState{
    SERVER_IDLE,
    SERVER_READY,
    SERVER_LISTENING,
    SERVER_CONNECTED
};

class TcpServer : public TcpBase
{
    Q_OBJECT
public:
    TcpServer(QObject *parent = nullptr);
    bool listenToConnect(QHostAddress addr, int port);
    bool stopListen();
private slots:
    void onNewConnectFromClient(void);
private:
    QTcpServer* server;
    ServerState serverState;
};

#endif // TCPSERVER_H
